function fn() {
  const arr = [1, 2, 3, 3,4,1];
  const map = new Map();
  for (let i = 0; i < arr.length; i++) {
    if (map.has(arr[i])) {
      map.set(arr[i], map.get(arr[i]) + 1);
    } else {
      map.set(arr[i], 1);
    }
  }
  console.log(JSON.stringify(Object.fromEntries(map))); // Map(4) {1 => 2, 2 => 1, 3 => 2, 4 => 1}
}
fn();


let obj = {
  a: 1,
  b: 2,
  c: 3,
  d: {
    e: 4,
    f: 5,
  }
}
obj[3425] = 2;
obj[2] = 7
console.log(obj); // { '2': 7, '3425': 2, a: 1, b: 2, c: 3 }

console.log(Object.keys(obj)); // [ '2', '3425', 'a', 'b', 'c' ]
console.log(Object.values(obj)); // [ 7, 2, 1, 2, 3 ]
console.log(Object.entries(obj)); // [ [ '2', 7 ], [ '3425', 2 ], [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ]


const str1 = "hello world";
const str2 = new String("hello world");
const str3 = String("hello world");
console.log(typeof str1); // string
console.log(typeof str2); // object
console.log(typeof str3); // string
console.log(str1 === str2); // false
console.log(str1 === str3); // true
console.log(str2.toString())
